let reducer = function (accumulator, currentValue, currentIndex, array) {
    stepRes = accumulator + currentValue
    console.log('accumulator,currentValue,currentIndex,array:', accumulator, currentValue, currentIndex, array)
    console.log("after executing", 'index', currentIndex, ":", stepRes)
    return stepRes;
};
console.log("debugin reducer...");

[11, 2, 1, 3, 4].reduce(reducer);
console.log("---------------------------------");
[0, 1, 2, 3, 4].reduce(reducer);
console.log("---------------------------------");
log
const initialValue = 10;
[0, 1, 2, 3, 4].reduce(reducer, initialValue);